<%@page import="com.yh.vo.ZhanfengVO"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/yh" prefix="t" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="/admin/head.jsp"></jsp:include>
	</head>
	<body>
		<jsp:include page="/admin/header.jsp"></jsp:include>
		<jsp:include page="/admin/left-menu.jsp"></jsp:include>
		<jsp:include page="/admin/footer.jsp"></jsp:include>

		<!--中间-->
		<section>
			<nav aria-label="breadcrumb">
				<ol class="breadcrumb">
					<li class="breadcrumb-item">管理首页</li>
					<li class="breadcrumb-item">系统中心</li>
					<li class="breadcrumb-item active">用户管理</li>
				</ol>
			</nav>

			<form class="form-inline">
				<div class="form-group mx-sm-1 mb-2">
					<label class="sr-only">新闻类别：</label>
					<select class="form-control">
						<option value="">全部</option>
					</select>
				</div>
				<div class="form-group mx-sm-1 mb-2">
					<label class="sr-only">关键字：</label>
					<input type="text" class="form-control" placeholder="搜索关键字">
				</div>
				<button type="submit" class="btn btn-primary mb-2"><i class="fa fa-search"></i></button>
				<a href="admin/user-add-form.jsp" class="btn btn-success ml-auto mr-2"><i class="fa fa-plus"></i></a>
				<div class="form-group mx-sm-1 mb-2">
				<label class="sr-only">数量：</label> <select name="pageSize"
					class="form-control">
					<c:forEach begin="5" end="20" step="5" var="i">
						<option value="${i }">每页${i }条</option>
					</c:forEach>
				</select>
			</div>
			</form>
			<div class="ml-2 mr-2">
				<table class="table table-striped table-bordered table-hover">
					<thead>
						<tr>
							<th scope="col">#</th>
							<th scope="col">用户名称</th>
							<th scope="col">用户年龄</th>
							<th scope="col">用户性别</th>
							<th scope="col">用户注册时间</th>
							<th scope="col">操作</th>
						</tr>
					</thead>
					
					<%-- <t:list list="${list }" varIndex="i" var="vo">--%>
					<c:forEach items="${list }" var="vo" varStatus="i">
					<tbody>
						<tr>
							<th scope="row">${i.index+1 }</th>
							<td>${vo.zfName }</td>
							<td>${vo.zfAge }</td>
							<td>${vo.zfSex }</td>
							<td><t:date date="${user.getZfTime() }" format="yy年MM月dd日"/></td>
							<td>
								<div class="dropdown">
  									<button class="btn btn-outline-primary btn-block dropdown-toggle" type="button" data-toggle="dropdown">
    									操作
  									</button>
  									<div class="dropdown-menu dropdown-menu-right">
    									<a class="dropdown-item" href="admin/user-look.let?userId=${vo.zfId }">查看</a>
    									<a class="dropdown-item" href="admin/user-update-form.let?userId=${vo.zfId }">修改</a>
    									<a class="dropdown-item _delete" href="admin/user-delete.let?userId=${vo.zfId }">删除</a>
  									</div>
								</div>
							</td>
						</tr>
					</tbody>
					</c:forEach>
					<%--</t:list>--%>
				</table>
			</div>
		</section>

		<div class="modal fade" id="confirmDialog" tabindex="-1">
  			<div class="modal-dialog">
    			<div class="modal-content">
      				<div class="modal-header">
        				<h5 class="modal-title" id="exampleModalLabel">确认对话框</h5>
        				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
          					<span aria-hidden="true">&times;</span>
       					</button>
      				</div>
      				<div class="modal-body">
        				您确定要删除这条记录吗？
      				</div>
      				<div class="modal-footer">
        				<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
        				<a href="#" class="btn btn-primary">确定</a>
      				</div>
    			</div>
  			</div>
		</div>  

	</body>

</html>
<script type="text/javascript">
	var confirmDialog = $("#confirmDialog");
	$("._delete").on("click",function(){
		confirmDialog.find("a:last").attr("href",$(this).attr("href"));
		confirmDialog.modal("show");
		return false;
	});
</script>